import { Component, OnInit } from '@angular/core';
import { NavigationEnd, NavigationStart, Route, Router, RoutesRecognized } from '@angular/router';
import { LayoutMenu } from './layout/layout.model';
import { globalStore } from '@ds/ds-micro/dist';

@Component({
  selector: '#ng-main app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less'],
})
export class AppComponent implements OnInit {
  tabs: LayoutMenu[] = [];
  currentIndex: number | null = null;

  isCollapsed = false;

  menu: LayoutMenu[] = [
    {
      name: '首页',
      link: '/index',
    },
    {
      name: 'CRM中心',
      children: [
        {
          name: '客户中心',
          children: [
            {
              name: '客户资料',
              host: 'https://customer.clink.cn:4201',
              link: '/customer/list',
            },
            {
              name: '新增',
              host: 'https://customer.clink.cn:4201',
              link: '/customer/add',
            },
            {
              name: '详情',
              host: 'https://customer.clink.cn:4201',
              link: '/customer/detail/list',
            },
            {
              name: '销售crm,模拟懒加载',
              children: [
                {
                  name: '列表',
                  host: 'https://customer.clink.cn:4201',
                  link: '/customer/crm-list/list',
                },
                {
                  name: '新增',
                  host: 'https://customer.clink.cn:4201',
                  link: '/customer/crm-list/add',
                },
              ],
            },
          ],
        },
        {
          name: '业务中心',
          children: [
            {
              name: '业务资料',
              host: 'https://business.clink.cn:4202',
              link: '/business/list',
            },
          ],
        },
      ],
    },
  ];

  constructor(private router: Router) {}

  ngOnInit() {
   
  }

  goto(item): void {
    this.tabs.push(item);
    this.currentIndex = this.tabs.length - 1;
  }
}
